package cn.itcast.user.UserServiceimpl;

import cn.itcast.user.UserService.UserService;


import cn.itcast.user.Userdao.UserDao;
import cn.itcast.user.Userdao.UserFeignClient;
import cn.itcast.user.domain.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cloud.client.ServiceInstance;
import org.springframework.cloud.client.discovery.DiscoveryClient;
import org.springframework.stereotype.Service;
import org.springframework.web.client.RestTemplate;

import java.util.ArrayList;
import java.util.List;
@Service
public class UserServiceimpl implements UserService {
    @Autowired
  private UserFeignClient userDao;
    public List<User> queryUserByIds(List<Long> ids) {
        List<User> users = new ArrayList<>();
        // 地址直接写服务名称即可

        ids.forEach(id -> {
            // 我们测试多次查询，
            users.add(this.userDao.queryUserById(id));


        });
        return users;
    }
}
